<?
	require_once('../inc/functions.php');
	$searchUrl = "http://search.twitter.com/search.json";
	$results = curl_get($searchUrl, "GET", array('q' => 'New Paltz'));
	//echo $results;
	$ob = json_decode($results);
	//print_r($ob);
	$tweets = $ob->results;
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Home Page</title>
    <link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css">
    <link rel="stylesheet" type="text/css" href="../inc/bootstrap.css">
    <style type="text/css" >
    	li {
    		margin: 5px;
			height: 50px;
    	}
		li img {
			float: left;
		}
 	</style>
</head>

<body>
        <? include('../inc/header.php'); ?>
        <div class="container">
			<? include('../inc/nav.php'); ?>
            <div id="contents">
		    	<h3>Searched for <?=$ob->query?></h3>
		    	<pre>
                	<? print_r($ob); ?>
                </pre>
			  	<ul class="unstyled">
	            	<? foreach ($tweets as $tweet): ?>
					  <li id="list_item_<?=$tweet->id?>">
					  	<img src="<?=$tweet->profile_image_url?>" />
					  	<?=$tweet->from_user_name?>
					  	(@<?=$tweet->from_user?>)
					    <?=$tweet->text?>
                        <br /> <?= html_entity_decode($tweet->source)?>
					  </li>
					<? endforeach; ?>
				</ul>  
            </div>
       </div>       
</body>
</html>

